package api

import (
	"example/controllers/admin"
	"github.com/gin-gonic/gin"
)

func InitApi(r *gin.Engine) {
	api := r.Group("/api")
	{
		api.GET("/list", admin.GetList)
		api.POST("/register", admin.Register)
		api.POST("/login", admin.UserLogin)
		api.POST("/upload", admin.UploadFile)
	}

	manage := r.Group("/manage")
	{
		manage.POST("/upload", admin.Upload)
		manage.GET("/profile/:name", admin.PreView)
	}

	hero := r.Group("/hero")
	//hero.Use(middleware.Auth())
	{
		hero.GET("/list", admin.Search)
		hero.POST("/add", admin.AddHero)
		hero.PUT("/edit", admin.UpdateHero)
		hero.DELETE("/del/:id", admin.DelHero)
	}
}
